<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>抬杆放行</title>
<script
	src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<link rel="stylesheet" href="/park/bootstrap/css/bootstrap.min.css" >
<link rel="stylesheet" href="/park/bootstrap/css/bootstrap-theme.min.css" >
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" >
<script src="/park/bootstrap/js/bootstrap.min.js" ></script>
<script src="/park/js/layer_mobile/layer.js?v=1.6"></script>
<script src="/park/js/vue.min.js"></script>
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js" ></script>
<style type="text/css">
#dataTable td,th{
	font-size:18px;
}
</style>
</head>
<body>
<div style="width: 96%;margin-left: 2%;margin-top: 100px;">
    <table class="table table-striped" id="dataTable">
       <tbody>
            <tr>
                <th style="text-align: center;vertical-align: inherit">请选择</th>
                <td>
                    <select class="form-control" id="text">
                        <option v-for="items in item" v-bind:value="items.gateNo" v-text="items.name+'-'+items.gateNo" ></option>
                    </select>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <button type="button" style="width: 100%;font-size:18px;line-height: 38px;height: 46px;" onclick="go()"  class="btn btn-success">确定抬杆</button>
                </td>
            </tr>
       </tbody>
    </table>
</div>
<script type="text/javascript">
    var param = getUrlParam('streetNo');
    var loginName = getUrlParam('loginName');
    $(function() {
        $.ajax({
            url: '/park/data/help/gateNo',
            data: 'streetNo=' + param + '&loginName=' + loginName,
            type: 'post',
            dataType: 'json',
            success: function (res) {
                if ('200' == res.code) {
                    if (res.data.status == 0) {
                        _parkStatus = 1;
                        if (_d2 == '') {
                            _d2 = new Vue({
                                el: '#dataTable',
                                data: {
                                    item: res.data.attr.result
                                }
                            })
                        } else {
                            _d2.item = res.data.attr.result
                        }
                    } else {
                        layer.open({
                            content: res.data.msg + '请联系管理员'
                            ,btn: '确定'
                            ,yes: function () {
                                location.href = '/park/helpMain?streetNo='+param+'&loginName='+loginName;
                            }
                        });
                    }
                } else {
                    layer.open({
                        content: '出错了！'
                        , skin: 'msg'
                        , time: 2 //2秒后自动关闭
                    });
                }
            }
        })
    })
function getUrlParam(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
    var r = window.location.search.substr(1).match(reg);  //匹配目标参数
    if (r != null) return unescape(r[2]); return null; //返回参数值
}
var _d2 ='';
var _parkStatus = 0;
function go(){
	var gateNo = $("#text option:selected").val();
	$.ajax({
		url:'/park/data/help/takePole',
		data:'streetNo='+param+'&gateNo='+gateNo+'&loginName='+loginName,
		type:'post',
		dataType:'json',
		success:function(res){
			if('200'==res.code){
				if(res.data.status==0){
                    layer.open({
                        content: res.data.msg,
                        btn: '确定',
                        yes: function(){
                            location.href = '/park/helpMain?streetNo='+param+'&loginName='+loginName;
                        }
                    });
				}else{
					layer.open({
					    content: res.data.msg
					    ,skin: 'msg'
					    ,time: 2 //2秒后自动关闭
					  });
				}
			}else{
				layer.open({
				    content: '出错了！'
				    ,skin: 'msg'
				    ,time: 2 //2秒后自动关闭
				  });
			}
		}
	})
}
        // function findData(){
        //     var plate = $('#plate').val();
        //     $.ajax({
        //         url: '/park/data/help/needPay',
        //         data: 'carLicense=' + plate + '&streetNo=' + param,
        //         type: 'post',
        //         dataType: 'json',
        //         success: function (res) {
        //             if ('200' == res.code) {
        //                 if (res.data.status == 0) {
        //                     _parkStatus = 1;
        //                     if (_d2 == '') {
        //                         _d2 = new Vue({
        //                             el: '#dataTable',
        //                             data: {
        //                                 item: res.data.attr
        //                             }
        //                         })
        //                     } else {
        //                         _d2.item = res.data.attr
        //                     }
        //                     $('#dataTable').show();
        //                 } else {
        //                     $('#dataTable').hide();
        //                     layer.open({
        //                         content: res.data.msg
        //                         , skin: 'msg'
        //                         , time: 2 //2秒后自动关闭
        //                     });
        //                 }
        //             } else {
        //                 $('#dataTable').hide();
        //                 layer.open({
        //                     content: '出错了！'
        //                     , skin: 'msg'
        //                     , time: 2 //2秒后自动关闭
        //                 });
        //             }
        //         }
        //     })
        // }
</script>
</body>
</html>